from Tkinter import *
class RawMaterial:
  def __init__(self, master, rawName, cost, stock):
    self.materialCost = cost
    self.rawStock = 0
    self.frame = Frame(master, width = 80, height = 40)
    self.frame.pack()
    self.RawName = Label(self.frame, text=rawName, bg = "yellow")
    self.RawName.place(relx = 0.33, relwidth = 0.66,
                         relheight = 0.5, rely = 0.25, anchor = CENTER)
    self.Cost = Label(self.frame, text="({0})".format(self.materialCost),
                            bg= "yellow")
    self.Cost.place(relx = 0.83, relwidth = 0.34,
                         relheight = 0.5,rely = 0.25, anchor = CENTER)
    self.RawStock = Label(self.frame, text = "0",
                            bg="yellow")
    self.RawStock.place(relx = 0.5, relwidth = 1.0,
                         relheight = 0.5,rely = 0.75, anchor = CENTER)

  def addMaterial(self, quantity):
    self.rawStock += quantity
    self.RawStock.config(text="{0}".format(self.rawStock))

